function LoginScreen()
{
	var htm='';
    htm+='    <table width="100%" id="login_table" border=0>';
    htm+='        	<tr>';
    htm+='            	<td align="center" valign="middle"> ';
    htm+='        <table width="600" height="300" align="center">';
    htm+='        	<tr>';
    htm+='            	<td width="50%" style="border-right:solid 1px #CCCCCC;padding:10px" valign="top" align="right"> ';
    htm+='                <br><br><br><br>';
    htm+='		<img src="/webservices/images/poweredby2.gif" style="margin:4px" border="0" />';
    htm+='        <h2>Please log in</h2>';
    htm+='        WARNING: This is a secure area. You must log in before you can continue past this point';
    htm+='                </td>';
    htm+='                <td nowrap> ';
    htm+='                        <table align="center">';
    htm+='                            <tr>';
    htm+='                                <td align="right" nowrap>';
    htm+='                                    <font color="#808080">';
    htm+='                                        <!--EventBuilder  -->User ID:';
    htm+='                                    </font>';
    htm+='                                </td>';
    htm+='                                <td>';
    htm+='                                    <input size="30" id="txtUserId" value="">';
    htm+='                                </td>';
    htm+='                            </tr>';
    htm+='                            <tr>';
    htm+='                                <td align="right">';
    htm+='                                    <font color="#808080">';
    htm+='                                        Password:';
    htm+='                                    </font>';
    htm+='                                </td>';
    htm+='                                <td>';
    htm+='                                    <input size="30" type="password" id="txtUserPass" value=""> ';
    htm+='                                </td>';
    htm+='                            </tr>';
    htm+='                            <tr> ';
    htm+='                                <td></td>';
    htm+='                                <td >';
    htm+='                                    <a href="javascript:void(0)" onclick="toggle(\'passInfo\')"';
    htm+='                                    >Forgot your password?</a> ';
    htm+='                                        <br/>';
    htm+='                                    <div id="passInfo" style="display:none">';
    htm+='                                    Enter your email address:';
    htm+='                                        <br/>';
    htm+='                                    	<input size="30" id="passOops">';
    htm+='                                        <input type="button" value="Send Password" onclick="remind (passOops.value)">  ';
    htm+='                                    </div>';
    htm+='                                </td>';
    htm+='                            </tr>';
    htm+='                            <tr> ';
    htm+='                                <td></td>';
    htm+='                                <td nowrap>';
    htm+='                                    <br>';
    htm+='                                    <br>';
    htm+='                                    <input type="checkbox" id="ckRem">';
    htm+='                                    Remember me on this computer';
    htm+='                                    <br>';
    htm+='                                    <input type="checkbox" id="ckPass">';
    htm+='                                    Remember my password ';
    htm+='                                </td>';
    htm+='                            </tr>';
    htm+='                            <tr> ';
    htm+='                                <td></td>';
    htm+='                                <td nowrap>';
    htm+='                                    <input value="Sign in" disabled id="bsignin"';
    htm+='                                    onclick="login(txtUserId.value, txtUserPass.value,ckRem.checked?1:0,ckPass.checked?1:0)" type="button">';
    htm+='                                    ';
    htm+='                                    <span id="loginstatus" style="color:red;font:bold 8pt tahoma"></span>';
    htm+='                                </td>';
    htm+='                            </tr>';
    htm+='                        </table>';
    htm+='                        </td>';
    htm+='                    </tr>';
    htm+='                </table>';
    htm+='                </td>';
    htm+='            </tr>';
    htm+='            <tr>';
    htm+='            <td colspan=2 align=center valign=top height=40>';
    htm+='            <div style="width:200;border:solid 1px #999;font-size:8pt;padding:10px;background-color:#f0f0f0;color:#999"';
    htm+='            ><img src="/webservices/images/explorer/chrome-16.png" style="margin-right:2px"';
    htm+='            ><label disabled>Optimized for <a href="http://www.google.com/chrome" target="_blank" style=color:blue>Google Chrome</a></label></div>';
    htm+='            ';
    htm+='            </td>';
    htm+='            </tr>';
    htm+='        </table>';
	return htm;
}

function OnLoginScreenRender()
{
    var dz=document.getElementById ('login_table');
    if (dz) dz.style.height=window_h();
    
    var bs=document.getElementById ('bsignin');
    var lo=document.getElementById ('loginstatus');
    if (lo) lo.innerHTML = 'looking up your IP address...'; 
     
    var RequestParams = { 
        'params' : { 'action' : 'check' },
        'aftersend' : LoginScreen.Process,
        'target' : window.currentpref,  
        'serializer' : function (target, data) { window.currentpref = new UserLoginPreferences (data); },
        'message' : 'loading preferences...' 
              };
    window.request.create (RequestParams);  
}


LoginScreen.Process = function ()
{
    var lo=document.getElementById ('loginstatus');
    var bs=document.getElementById ('bsignin');
    
    if (window.currentpref&&window.currentpref.userid)
    { 
        
        txtUserId.value   = window.currentpref.userid;
        txtUserPass.value = window.currentpref.password;
        ckRem.checked     = window.currentpref.remember;
        ckPass.checked    = window.currentpref.password.length > 0;
        if (bs && window.http.readyState==ReadyState.DONE && GetFunctionFromURL(location.href)) 
        {
            login(txtUserId.value, txtUserPass.value,ckRem.checked?1:0,ckPass.checked?1:0) 
        }
    } 
    if (lo) lo.innerHTML = 'Please log in to continue';
    if (bs) bs.disabled = false;
}


function BeforeLogin ()
{
    var bs=document.getElementById ('bsignin');  
    var lo=document.getElementById ('loginstatus');  
    if (bs) bs.disabled = true;  
    if (lo) lo.innerHTML = 'please wait...';   
} 

function ValidateLogin ()
{
    var bs=document.getElementById ('bsignin');  
    var lo=document.getElementById ('loginstatus');  
    if (window.loggedinuser)  
    {   
        BeginPageLoading (); 
    }  
    else  
    {  
        if (lo) lo.innerHTML = 'Login failed!';  
        if (bs) bs.disabled = false;  
        alert ("Login failed! " + window.http.responseText);  
    }  
}  